<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:display="http://www.w3.org/1999/xhtml"
>
<head>
    <script th:src="@{/vendor/jquery/jquery.min.js}"></script>
    <script th:src="@{/vendor/bootstrap/js/bootstrap-table.js}"></script>
    <!-- Bootstrap Core JavaScript -->
    <script th:src="@{/vendor/bootstrap/js/bootstrap.min.js}"></script>
    <!-- Metis Menu Plugin JavaScript -->
    <script th:src="@{/vendor/metisMenu/metisMenu.min.js}"></script>
    <!-- Custom Theme JavaScript -->
    <script th:src="@{/dist/js/sb-admin-2.js}"></script>
    <script th:src="@{/vendor/datepicker/bootstrap-datepicker.js}"></script>
    <link href="/vendor/bootstrap/css/bootstrap-table.css" rel="stylesheet">
    <link href="/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <!-- MetisMenu CSS -->
    <link href="/vendor/metisMenu/metisMenu.min.css" rel="stylesheet">
    <!-- Custom CSS -->
    <link href="/dist/css/sb-admin-2.css" rel="stylesheet">
    <link href="/vendor/datepicker/datepicker3.css" rel="stylesheet">
    <!-- Custom Fonts -->
    <link href="/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <meta charset="UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>LoanApplicantShareholderInfor</title>

    <!-- Bootstrap Core CSS -->


</head>

<!--onload="getCustCode()"-->
<body>

<div id="page-LoanApplicantShareholderInfor">
    <ul id="myTab" class="nav nav-tabs">
        <li class="active">
            <a href="#home" data-toggle="tab">
                股东信息
            </a>
        </li>
        <li><a href="javascript:void(0)" id="addAction" onclick="addAction()">新增</a></li>
        <li data-toggle="modal" data-target="#myModal"><a href="javascript:void(0)">删除</a></li>
        <!-- 模态框（Modal） -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
             aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                            &times;
                        </button>
                        <h4 class="modal-title" id="myModalLabel">
                            确认信息
                        </h4>
                    </div>
                    <div class="modal-body">
                        确认删除此条记录吗？
                    </div>
                    <div class="modal-footer">
                        <button type="button" id="cancel" class="btn btn-default" data-dismiss="modal">
                            取消
                        </button>
                        <button type="button" id="confirm" class="btn btn-primary">
                            确认
                        </button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
        </div>
    </ul>
    <div class="tab-pane fade in active" id="home">
        <form name="LoanApplicantShareholderInfor_Personal" th:action="@{/LoanApplicantShareholderInforPersonal}"
              id="LoanApplicantShareholderInfor_Personal"
              th:object="${loanApplicantShareholderInfor_Personal_entity}"
              method="post">
            <input class="form-control" id="Personalid" type="hidden" name="Personalid" th:field="*{Personalid}">
            <input class="form-control" id="PersonalCustCod" type="hidden" name="PersonalCustCod"
                   th:field="*{PersonalCustCod}">
            <div class="panel panel-default" id="collapsePersonal">
                <div class="panel-heading">
                    <h4 class="panel-title">
                        <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">个人股东</a>
                    </h4>
                </div>
                <div id="collapseOne" class="panel-collapse collapse in">
                    <div class="panel-body">
                        <br/>

                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>股东类型:</label>
                                </div>
                                <div class="col-lg-4">
                                    <select class="form-control" th:field="*{PersonalType}"
                                            onchange="stateChangePersonal()"
                                            id="PersonalType" name="PersonalType">
                                        <option selected="" value="1">个人股东</option>
                                        <option value="2">企业股东</option>
                                    </select>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label></label>
                                </div>
                                <div class="col-lg-4">
                                    <div th:if="${#fields.hasErrors('PersonalType')}"
                                         th:errors="${loanApplicantShareholderInfor_Personal_entity.PersonalType}"
                                         class="alert alert-danger">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>股东名称:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{PersonalName}"
                                           name="PersonalName " maxlength="40" id="PersonalName">
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label></label>
                                </div>
                                <div class="col-lg-8">
                                    <div th:if="${#fields.hasErrors('PersonalName')}"
                                         th:errors="${loanApplicantShareholderInfor_Personal_entity.PersonalName}"
                                         class="alert alert-danger">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>证件类型/登记注册号类型:</label>
                                </div>
                                <div class="col-lg-8">
                                    <select class="form-control" id="PersonalIDtype" th:field="*{PersonalIDtype}"
                                            name="PersonalIDtype">
                                        <option th:each="PersonalIDtype:${CCYInfoList}"
                                                th:value="${PersonalIDtype.CSTCOD2}"
                                                th:text="${PersonalIDtype.CSTLDES}"></option>
                                    </select>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label></label>
                                </div>
                                <div class="col-lg-8">
                                    <div th:if="${#fields.hasErrors('PersonalIDtype')}"
                                         th:errors="${loanApplicantShareholderInfor_Personal_entity.PersonalIDtype}"
                                         class="alert alert-danger">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>证件号码/登记注册号:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{PersonalIDNumber}"
                                           name="PersonalIDNumber " maxlength="20"
                                           id="PersonalIDNumber">
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label></label>
                                </div>
                                <div class="col-lg-8">
                                    <div th:if="${#fields.hasErrors('PersonalIDNumber')}"
                                         th:errors="${loanApplicantShareholderInfor_Personal_entity.PersonalIDNumber}"
                                         class="alert alert-danger">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>持股比例(%):</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{PersonalProportion}"
                                           name="PersonalProportion " maxlength="40"
                                           id="PersonalProportion">
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label></label>
                                </div>
                                <div class="col-lg-8">
                                    <div th:if="${#fields.hasErrors('PersonalProportion')}"
                                         th:errors="${loanApplicantShareholderInfor_Personal_entity.PersonalProportion}"
                                         class="alert alert-danger">
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
                <!--表格-->
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" data-parent="#accordion" href="#collapseHistoryPersonal">保存记录</a>
                        </h4>
                    </div>
                    <div id="collapseHistoryPersonal" class="panel-collapse collapse in">
                        <div class="panel-body">
                            <table id="historyTablePersonal">
                                <thead>
                                </thead>
                            </table>
                            <br/>
                        </div>
                    </div>

                </div>
                <div class="row">
                    <div class="col-lg-4"></div>
                    <div class="col-lg-4" align="center">
                        <button type="reset" class="btn btn-primary">重 填</button>
                        <button type="submit" class="btn btn-primary">保 存</button>
                    </div>
                    <div class="col-lg-4"></div>
                </div>
            </div>
        </form>
        <!--企业股东-->
        <form name="LoanApplicantShareholderInfor_Enterprise" th:action="@{/LoanApplicantShareholderInforEnterprise}"
              id="LoanApplicantShareholderInfor_Enterprise"
              th:object="${loanApplicantShareholderInfor_Enterprise_entity}"
              method="post">
            <input class="form-control" id="Enterpriseid" type="hidden" name="Enterpriseid" th:field="*{Enterpriseid}">
            <input class="form-control" id="EnterpriseCustCod" type="hidden" name="EnterpriseCustCod"
                   th:field="*{EnterpriseCustCod}">
            <div class="panel panel-default" id="collapseEnterprise" style="display: none">
                <div class="panel-heading">
                    <h4 class="panel-title">
                        <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">企业股东</a>
                    </h4>
                </div>

                <div id="collapseTwo" class="panel-collapse collapse in">
                    <div class="panel-body">
                        <br/>

                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>股东类型:</label>
                                </div>
                                <div class="col-lg-4">
                                    <select class="form-control" th:field="*{EnterpriseType}"
                                            onchange="stateChangeEnterprise()"
                                            id="EnterpriseType" name="EnterpriseType">
                                        <option value="1">个人股东</option>
                                        <option selected="" value="2">企业股东</option>
                                    </select>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label></label>
                                </div>
                                <div class="col-lg-4">
                                    <div th:if="${#fields.hasErrors('EnterpriseType')}"
                                         th:errors="${loanApplicantShareholderInfor_Enterprise_entity.EnterpriseType}"
                                         class="alert alert-danger">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>股东名称:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{EnterpriseName}"
                                           name="EnterpriseName " maxlength="40" id="EnterpriseName">
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label></label>
                                </div>
                                <div class="col-lg-8">
                                    <div th:if="${#fields.hasErrors('EnterpriseName')}"
                                         th:errors="${loanApplicantShareholderInfor_Enterprise_entity.EnterpriseName}"
                                         class="alert alert-danger">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>证件类型/登记注册号类型:</label>
                                </div>
                                <div class="col-lg-8">
                                    <select class="form-control" id="EnterpriseIDtype" th:field="*{EnterpriseIDtype}"
                                            name="EnterpriseIDtype">
                                        <option th:each="EnterpriseIDtype:${CCYInfoList}"
                                                th:value="${EnterpriseIDtype.CSTCOD2}"
                                                th:text="${EnterpriseIDtype.CSTLDES}"></option>
                                    </select>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label></label>
                                </div>
                                <div class="col-lg-8">
                                    <div th:if="${#fields.hasErrors('EnterpriseIDtype')}"
                                         th:errors="${loanApplicantShareholderInfor_Enterprise_entity.EnterpriseIDtype}"
                                         class="alert alert-danger">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>证件号码/登记注册号:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{EnterpriseIDNumber}"
                                           name="EnterpriseIDNumber " maxlength="20"
                                           id="EnterpriseIDNumber">
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label></label>
                                </div>
                                <div class="col-lg-8">
                                    <div th:if="${#fields.hasErrors('EnterpriseIDNumber')}"
                                         th:errors="${loanApplicantShareholderInfor_Enterprise_entity.EnterpriseIDNumber}"
                                         class="alert alert-danger">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>持股比例(%):</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{EnterpriseProportion}"
                                           name="EnterpriseProportion " maxlength="40"
                                           id="EnterpriseProportion">
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label></label>
                                </div>
                                <div class="col-lg-8">
                                    <div th:if="${#fields.hasErrors('EnterpriseProportion')}"
                                         th:errors="${loanApplicantShareholderInfor_Enterprise_entity.EnterpriseProportion}"
                                         class="alert alert-danger">
                                    </div>
                                </div>
                            </div>
                        </div>


                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>企业重要股东组织机构代码:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{EnterpriseOrganizationcode}"
                                           name="EnterpriseOrganizationcode" maxlength="10"
                                           id="EnterpriseOrganizationcode">
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label></label>
                                </div>
                                <div class="col-lg-8">
                                    <div th:if="${#fields.hasErrors('EnterpriseOrganizationcode')}"
                                         th:errors="${loanApplicantShareholderInfor_Enterprise_entity.EnterpriseOrganizationcode}"
                                         class="alert alert-danger">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>企业重要股东机构信用代码:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{EnterpriseAgencyCreditcode}"
                                           name="EnterpriseAgencyCreditcode" maxlength="10"
                                           id="EnterpriseAgencyCreditcode">
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label></label>
                                </div>
                                <div class="col-lg-8">
                                    <div th:if="${#fields.hasErrors('EnterpriseAgencyCreditcode')}"
                                         th:errors="${loanApplicantShareholderInfor_Enterprise_entity.EnterpriseAgencyCreditcode}"
                                         class="alert alert-danger">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-4"></div>
                            <div class="col-lg-4" align="center">
                                <button type="reset" class="btn btn-primary">重 填</button>
                                <button type="submit" class="btn btn-primary">保 存</button>
                            </div>
                            <div class="col-lg-4"></div>
                        </div>
                    </div>
                </div>

                <!--表格-->
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" data-parent="#accordion"
                               href="#collapseHistoryEnterprise">保存记录</a>
                        </h4>
                    </div>
                    <div id="collapseHistoryEnterprise" class="panel-collapse collapse in">
                        <div class="panel-body">
                            <table id="historyTableEnterprise">
                                <thead>
                                </thead>
                            </table>
                            <br/>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>


<script>
    var state = "1";
    $(document).ready(function () {
        $.ajax({
            type: "get",
            url: "/LoanApplicantShareholderInfor/getState",
            async: true,
            success: function (data) {
                state = data;
                if (state == "1") {
                    $('#PersonalType').val("1");
                    document.getElementById("collapsePersonal").style.display = 'block';
                    document.getElementById("collapseEnterprise").style.display = 'none';
                }
                else if (state == "2") {
                    $('#EnterpriseType').val("2");
                    document.getElementById("collapsePersonal").style.display = 'none';
                    document.getElementById("collapseEnterprise").style.display = 'block';
                }
            }
        });

    })


    function stateChangePersonal() {
        var PersonalType = document.getElementById("PersonalType");
        var EnterpriseType = document.getElementById("EnterpriseType");
        state = PersonalType.value;
        $.ajax({
            type: 'get',
            url: '/LoanApplicantShareholderInfor/postState?'
            + 'state=' + state,
            success: function (data) {

            },
            error: function () {
                alert("error");
            }
        });
        EnterpriseType.value = state;
        if (state == "1") {
            document.getElementById("collapsePersonal").style.display = 'block';
            document.getElementById("collapseEnterprise").style.display = 'none';
        }
        else if (state == "2") {
            document.getElementById("collapsePersonal").style.display = 'none';
            document.getElementById("collapseEnterprise").style.display = 'block';
        }
    }

    function stateChangeEnterprise() {
        var PersonalType = document.getElementById("PersonalType");
        var EnterpriseType = document.getElementById("EnterpriseType");
        state = EnterpriseType.value;
        PersonalType.value = state;
        if (state == "1") {
            document.getElementById("collapsePersonal").style.display = 'block';
            document.getElementById("collapseEnterprise").style.display = 'none';
        }
        else if (state == "2") {
            document.getElementById("collapsePersonal").style.display = 'none';
            document.getElementById("collapseEnterprise").style.display = 'block';
        }
    }


    $('#historyTablePersonal').bootstrapTable({
        url: '/LoanApplicantShareholderInfor/getHistoryList',         //请求后台的URL（*）
        method: 'get',                      //请求方式（*）
        toolbar: '#toolbar',                //工具按钮用哪个容器
        striped: true,                      //是否显示行间隔色
        cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
        sortable: true,                     //是否启用排序
        sortOrder: "asc",
//        dataField: "data",//这是返回的json数组的key.默认好像是"rows".这里只有前后端约定好就行
        locale: 'zh-CN',                     //中文支持
        pagination: true,                   //是否分页
        sidePagination: 'server',           //指定服务器端分页
        pageNumber: 1,                      //初始化加载第一页，默认第一页
        pageSize: 5,                       //每页的记录行数（*）
        pageList: [5, 10, 15, 50, 100, 'ALL'],        //可供选择的每页的行数（*）
//        search: true,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
        strictSearch: true,                 //搜索
        showColumns: true,                  //是否显示所有的列
        showRefresh: true,                  //是否显示刷新按钮
        minimumCountColumns: 1,             //最少允许的列数
        clickToSelect: true,                //是否启用点击选中行
//                height: 500,              //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
        uniqueId: "id",               //每一行的唯一标识，一般为主键列
        showToggle: true,                    //是否显示详细视图和列表视图的切换按钮
        cardView: false,                    //是否显示详细视图
        detailView: false,                   //是否显示父子表
        queryParams: PqueryParams,//请求服务器时所传的参数
        responseHandler: PresponseHandler,//请求数据成功后，渲染表格前的方法
        onClickRow: PonClickRow,
        columns: [{
            field: 'id',
            title: 'Id'
        }, {
            field: 'Name',
            title: '股东名称'
        }, {
            field: 'Type',
            title: '股东类型'
        }, {
            field: 'IDtype',
            title: '证件类型/登记注册号类型'
        }, {
            field: 'IDNumber',
            title: '证件号码/登记注册号'
        }, {
            field: 'Proportion',
            title: '持股比例（%）'
        }]
    })

    //点击行事件
    function PonClickRow(item, $element) {
        $('#Personalid').val(item.id);
        $('#PersonalCustCod').val(item.CustCod);
        $('#PersonalType').val(item.Type.replace(/(^\s*)|(\s*$)/g, ""));
        $('#PersonalIDtype').val(item.IDtype.replace(/(^\s*)|(\s*$)/g, ""));
        $('#PersonalIDNum').val(item.IDNum);
        $('#PersonalIDNumber').val(item.IDNumber);
        $('#PersonalName').val(item.Name);
        $('#PersonalProportion').val(item.Proportion);
    }

    //请求服务数据时所传参数
    function PqueryParams(params) {
        var TypeE = document.getElementById("PersonalType");
        return {
            pageSize: params.limit, //每一页的数据行数，默认是上面设置的10(pageSize)
            pageIndex: params.offset / params.limit + 1, //当前页面,默认是上面设置的1(pageNumber)
            Type: 1

        }
    }

    //请求成功方法
    function PresponseHandler(result) {
        var errCode = result.errCode;//在此做了错误代码的判断
        if (errCode != 0) {
            alert("错误代码" + errCode);
            return;
        }
        //如果没有错误则返回数据，渲染表格
        return {
            total: result.dataLength, //总页数,前面的key必须为"total"
            rows: result.rowDatas //行数据，前面的key要与之前设置的dataField的值一致.
        };
    }

    $('#historyTableEnterprise').bootstrapTable({
        url: '/LoanApplicantShareholderInfor/getHistoryList',         //请求后台的URL（*）
        method: 'get',                      //请求方式（*）
        toolbar: '#toolbar',                //工具按钮用哪个容器
        striped: true,                      //是否显示行间隔色
        cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
        sortable: true,                     //是否启用排序
        sortOrder: "asc",
//        dataField: "data",//这是返回的json数组的key.默认好像是"rows".这里只有前后端约定好就行
        locale: 'zh-CN',                     //中文支持
        pagination: true,                   //是否分页
        sidePagination: 'server',           //指定服务器端分页
        pageNumber: 1,                      //初始化加载第一页，默认第一页
        pageSize: 5,                       //每页的记录行数（*）
        pageList: [5, 10, 15, 50, 100, 'ALL'],        //可供选择的每页的行数（*）
//        search: true,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
        strictSearch: true,                 //搜索
        showColumns: true,                  //是否显示所有的列
        showRefresh: true,                  //是否显示刷新按钮
        minimumCountColumns: 1,             //最少允许的列数
        clickToSelect: true,                //是否启用点击选中行
//                height: 500,              //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
        uniqueId: "id",               //每一行的唯一标识，一般为主键列
        showToggle: true,                    //是否显示详细视图和列表视图的切换按钮
        cardView: false,                    //是否显示详细视图
        detailView: false,                   //是否显示父子表
        queryParams: EqueryParams,//请求服务器时所传的参数
        responseHandler: EresponseHandler,//请求数据成功后，渲染表格前的方法
        onClickRow: EonClickRow,
        columns: [{
            field: 'id',
            title: 'Id'
        }, {
            field: 'Name',
            title: '股东名称'
        }, {
            field: 'Type',
            title: '股东类型'
        }, {
            field: 'IDtype',
            title: '证件类型/登记注册号类型'
        }, {
            field: 'IDNumber',
            title: '证件号码/登记注册号'
        }, {
            field: 'Proportion',
            title: '持股比例（%）'
        }, {
            field: 'Organizationcode',
            title: '企业重要股东组织机构代码'
        }, {
            field: 'AgencyCreditcode',
            title: '企业重要股东机构信用代码'
        }]
    })

    //点击行事件
    function EonClickRow(item, $element) {
        $('#Enterpriseid').val(item.id);
        $('#EnterpriseCustCod').val(item.CustCod);
        $('#EnterpriseType').val(item.Type.replace(/(^\s*)|(\s*$)/g, ""));
        $('#EnterpriseIDtype').val(item.IDtype.replace(/(^\s*)|(\s*$)/g, ""));
        $('#EnterpriseIDNum').val(item.IDNum);
        $('#EnterpriseIDNumber').val(item.IDNumber);
        $('#EnterpriseName').val(item.Name);
        $('#EnterpriseProportion').val(item.Proportion);
        $('#EnterpriseOrganizationcode').val(item.Organizationcode);
        $('#EnterpriseAgencyCreditcode').val(item.AgencyCreditcode);
    }

    //请求服务数据时所传参数
    function EqueryParams(params) {
        var TypeE = document.getElementById("EnterpriseType");
        return {
            pageSize: params.limit, //每一页的数据行数，默认是上面设置的10(pageSize)
            pageIndex: params.offset / params.limit + 1, //当前页面,默认是上面设置的1(pageNumber)
            Type: 2
        }
    }

    //请求成功方法
    function EresponseHandler(result) {
        var errCode = result.errCode;//在此做了错误代码的判断
        if (errCode != 0) {
            alert("错误代码" + errCode);
            return;
        }
        //如果没有错误则返回数据，渲染表格
        return {
            total: result.dataLength, //总页数,前面的key必须为"total"
            rows: result.rowDatas //行数据，前面的key要与之前设置的dataField的值一致.
        };
    };

    $('#confirm').click(function () {
        var id_value;
        if (state == "1") id_value = $('#Personalid').val();
        else if (state == "2") id_value = $('#Enterpriseid').val();
        if (id_value != ""){
            $.ajax({
                type: 'get',
                url: '/LoanApplicantShareholderInforDELETE/delete?'
                + 'id=' + id_value
                + '&&state=' + state,
                success: function (data) {
                    location.replace("/LoanApplicantShareholderInfor");
                },
                error: function () {
                    alert("error");
                }
            });
        }
        else
            alert("没有发现相关记录");
    });

    function addAction() {
        if (state == "1") {
            $('#Personalid').val("");
            $('#LoanApplicantShareholderInfor_Personal').submit();
        }
        else if (state == "2") {
            $('#Enterpriseid').val("");
            $('#LoanApplicantShareholderInfor_Enterprise').submit();
        }
    }


</script>
</body>

</html>